home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Original Code / Lines Curves and Area Fills / FourByFours / FourByFours.cs next >
Encoding:
Text File  |  2001-01-15  |  1.1 KB  |  34 lines

  1. //------------------------------------------
  2. // FourByFours.cs ⌐ 2001 by Charles Petzold
  3. //------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class FourByFours: PrintableForm
  9. {
  10.      public new static void Main()
  11.      {
  12.           Application.Run(new FourByFours());
  13.      }
  14.      public FourByFours()
  15.      {
  16.           Text = "Four by Fours";
  17.      }
  18.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy) 
  19.      {
  20.           Pen   pen   = new Pen(clr);
  21.           Brush brush = new SolidBrush(clr);
  22.           
  23.           grfx.DrawRectangle(pen, new Rectangle(2, 2, 4, 4));
  24.           grfx.DrawRectangles(pen, new Rectangle[] 
  25.                                              {new Rectangle(8, 2, 4, 4)});
  26.           grfx.DrawEllipse(pen, new Rectangle(14, 2, 4, 4));
  27.  
  28.           grfx.FillRectangle(brush, new Rectangle(2, 8, 4, 4));
  29.           grfx.FillRectangles(brush, new Rectangle[] 
  30.                                              {new Rectangle(8, 8, 4, 4)});
  31.           grfx.FillEllipse(brush, new Rectangle(14, 8, 4, 4));
  32.      }
  33. }
  34.